const UserIndex = {
    template:'#userIndex',
    components:{
        'user-head': UserHead,
        'updated-user-modal': UpdatedUserModal
    },
    data(){
        return {
            tableData: [],
            isOnlineShow: 0,
            currentPage: 1,
            totalCount: 0,
            pageSize: 7,
            isShowUpdatedUserModal: false,
        }
    },
    methods:{
        updatedModalClose: function () {
            this.isShowUpdatedUserModal = false;
        },
        handleEdit: function (e,index,row) {
            console.log(e,index,row);
            this.isShowUpdatedUserModal = true;
        },
        confirmDeleteHandle: function (e,index,row) {
            console.log('确定删除',e,index,row);
        },
        handleChange: function (e) {
            console.log(e);
        },
        //页面大小改变
        handlePageSizeChange: function (pageSize) {
            this.pageSize = pageSize;
            this.requestPage();
        },
        //当前页改变
        handleCurrentPageChange: function (currPageNo) {
            this.currentPage = currPageNo - 1;
            this.requestPage();
        },
        requestPage: function(){
            axios.get(
                "/system/user/findPage",
                {
                    params:{
                        page: this.currentPage,
                        size: this.pageSize,
                        dir: "mobile",
                        sort: "DESC",
                        searchInfo: null
                    },
                }
            ).then(response => {
                console.log('response:',response);
                const rep = response.data;
                if(rep.code!="0000"){
                    this.$message({ showClose: true, message: '添加错误，' + rep.data.info, type: 'error'});
                }
                this.tableData = rep.data.content;
                this.totalCount = rep.data.totalElements;
            }).finally()
        }
    },
    created: function () {
        this.requestPage();
    }

}